package cc.vicp.djx314.starfood.quartz;

import java.util.Calendar;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;

import cc.vicp.djx314.starfood.dao.count.CountMapper;

public class CountSumForDish {
	@Autowired
	CountMapper countMapper;

	@Deprecated
	public void insertCountDishLastWeek() {
		Date lastWeek = new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000);
		Calendar lastWeekCal = Calendar.getInstance();
		lastWeekCal.setTime(lastWeek);
		lastWeekCal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
		java.sql.Date lastSunday = new java.sql.Date(lastWeekCal.getTimeInMillis());
		lastWeekCal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
		java.sql.Date lastSaturday = new java.sql.Date(lastWeekCal.getTimeInMillis());
		countMapper.insertCountDishLastWeek(lastSunday, lastSaturday);
	}
}